export default {
	isDevelopment() {
		return process.env.NODE_ENV === "development";
	},
	formatBytesSize(size, fixed = 1) {
		if (0 == size) return "0 B";
		var c = 1024,
			d = fixed || 2,
			e = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
			f = Math.floor(Math.log(size) / Math.log(c));
		return parseFloat((size / Math.pow(c, f)).toFixed(d)) + " " + e[f];
	},
	gpParams(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
		var r = window.location.search.substr(1).match(reg);
		if (r != null) {
			return decodeURI(r[2]);
		} else {
			return null;
		}
	},
	is_android() {
		var ua = navigator.userAgent.toLowerCase();
		if (ua.match(/android/i) == "android") {
			return true;
		} else {
			return false;
		}
	},
	is_apple() {
		var ua = navigator.userAgent.toLowerCase();
		if (ua.match(/iphone/i) == "iphone" ||
			ua.match(/ipad/i) == "ipad" ||
			ua.match(/ipod/i) == "ipod") {
			return true;
		} else {
			return false;
		}
	},
	is_weixin() {
		var ua = navigator.userAgent.toLowerCase();
		if (ua.match(/MicroMessenger/i) == "micromessenger") {
			return true;
		} else {
			return false;
		}
	},
	is_qq_internal() {
		var ua = navigator.userAgent.toLowerCase();
		return !!ua.match(/ qq\//i); //qq的userAgent的前面有个空格，后面有个斜杆
	},
}